const state = {
  goodsList: JSON.parse(sessionStorage.getItem('goodsList')) || {}
}

const mutations = {
  GOODS_LIST: (state, goods) => {
    state.goodsList = goods
  }
}

const actions = {
  setGoodsList({ commit }, goodsList) {
    // sessionStorage.setItem('goodsList', goodsList)
    sessionStorage.setItem('goodsList', JSON.stringify(goodsList))
    commit('GOODS_LIST', goodsList)
  }
}

export default {
  namespaced: true,
  state,
  mutations,
  actions
}
